package com.pai4j.client.service;
import com.pai4j.common.bean.PAIResponseBean;
import com.pai4j.common.bean.PAIResponseBeanUtil;
import com.pai4j.domain.vo.response.subjectaccount.ArticleBaseResponseVO;
import com.pai4j.remote.pgc.SubjectArticleClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ArticleService {


    @Autowired
    private SubjectArticleClient subjectArticleClient;

    /**
     * 获取文章详情
     *
     * @param id
     * @return
     */
    public ArticleBaseResponseVO detail(Long id, String userId) {
        PAIResponseBean<ArticleBaseResponseVO> responseBean = subjectArticleClient.detail(id, true);
        if (PAIResponseBeanUtil.isOk(responseBean)) {
            return responseBean.getData();
        }
        return null;
    }
}
